<template>
  <div>
    <dv-scroll-ranking-board :config="config" class="scroll" />
  </div>
</template>

<script setup>
//导入依赖
import { onMounted, ref } from 'vue'
import { ListCompany } from "@/api/screen/company.js";

//定义对象
const config = ref({
  data: [],
  unit: "人",
  sort: true
})

//获取数据
async function init() {
  const response = (await ListCompany()).data;
  // console.log(response)

  const dataList = response.sort((a,b)=>b.recruitCount-a.recruitCount).slice(0,10);

  // console.log(dataList)

  for (const item of dataList) {

    config.value.data.push({
      name: item.companyName,
      value: item.recruitCount
    })
  }
}

//初始化渲染
onMounted(async () => {
  await init()
})
</script>

<style>
.scroll {
  width: 100%;
  height: 100%;
  padding: 0px 20px 10px 10px;
  text-align: left;
}
</style>